/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package com.xc.hotelmgr.webapi.modules.app.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * 飞猪订单接入
 *
 * @author kemmy
 */
@RestController
@RequestMapping("/app")
@Api("APP登录接口")
public class OrderController {
    @PostMapping("order")
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Request get XML Data
        BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream(), "UTF-8"));
        StringBuilder sb = new StringBuilder();
        String line = null;
        while ((line = br.readLine()) != null) {
            sb.append(line);
        }
        String postXMLData = sb.toString();
//       com.sun.org.apache.xml.internal.utils.X XmlUtils.loadXMLRootElementByXMLString(postXMLData, "UTF-8");
//TODO: 处理RQ数据，返回XML结果
        //String result = dealData(root);

        //返回处理结果
        response.setCharacterEncoding("UTF-8");
        //response.getWriter().write(result);
    }

}
